<?php

require_once 'Abstract.php';

class LayeredContent_Handler_Cache extends LayeredContent_Handler_Abstract
{
	
	/**
	 * Specifies whether a valid cahce exists. Takes into account the cache
	 * expire configuration option
	 *
	 * @return boolean
	 */
	public function hasCache()
	{
		
		// no valid cache was found, we must "listen" for the ouput of this
		// script and save it for future calls
		ob_start(array($this, 'saveCache'));
		
		return false;
	}
	
	/**
	 * If the browser has this page already cached. This method will also send
	 * the Last-Modified and ETag headers and if the cache is current a 304 Not
	 * Modified header.
	 * 
	 * @return boolean Whether the browser has it currently cached and the 304
	 * header was sent. Should stop execution if true.
	 */
	public function isCachedByBrowser()
	{
		return false;
	}
	
	/**
	 * Returns the contents of the cache to be sent to the browser. May also
	 * set the Content-Type header if needed.
	 *
	 * @return string The cache contents
	 */
	public function getCache()
	{
		return '';
	}
	
	
	public function saveCache($contents)
	{
		return $contents;
	}
}
